/*
 * ImageUtil.h
 *
 *  Created on: Jul 12, 2009
 *      Author: kurt
 */

#ifndef IMAGEUTIL_H_
#define IMAGEUTIL_H_

#include <psptypes.h>
#include <string>
#include <pspgu.h>
#include "VirtualFile.h"

namespace objdraw 
{
class Image;
class DrawingCanvas;
class ImageUtil 
{
	public:
		static const u8 pixelWidths[];
		static const u8 paletteSizes[];
		static bool auto_swizzle;
		
		typedef short PixelFormat;
		
		static int getNextPower2(int width);
		static bool is_png(std::string file);
		static bool is_png(VirtualFile * fp);
		
		static Image * loadImageFile(std::string file, DrawingCanvas * canvas = NULL);
		static Image * loadImageFile(std::string file, PixelFormat pixelFormat, DrawingCanvas * canvas = NULL);
		static Image * loadImageFile(std::string file, PixelFormat pixelFormat, bool in_vram, DrawingCanvas * canvas = NULL);
		static Image * loadImageFile(std::string file, PixelFormat pixelFormat, bool swizzle, bool in_vram, DrawingCanvas * canvas = NULL);
		
		static Image * loadImageFilePNG(std::string file, PixelFormat pixelFormat, bool swizzle, bool in_vram, DrawingCanvas * canvas = NULL);
		static Image * loadImageFilePNG(VirtualFile * fp, PixelFormat pixelFormat, bool swizzle, bool in_vram, DrawingCanvas * canvas = NULL);
		
		static Image * convertImageTo(Image * image, bool in_vram, PixelFormat pixelFormat);
};

}

#endif /* IMAGEUTIL_H_ */
